<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['base_path']?>public/css/style.css" media="screen" />
        <link rel="shortcut_icon" href="<?php echo $GLOBALS['base_path']?>public/img/icon.ico" />
		<link rel="icon" href="<?php echo $GLOBALS['base_path']?>public/img/icon.png" />
		<title>Foto</title>
        <script type="text/javascript" src="<?php echo $GLOBALS['base_path']?>public/js/fquery.js"></script>
        <script type="text/javascript" >
                var validator = {
                        'name': {
                                'regex' : /^[A-Za-z\s]{5,}$/,
                                'message' : 'Nama hanya boleh mengandung spasi dan alfabet dan minimum 5 karakter'
                        },
                        'username' : {
                                'regex' : /^[A-Za-z0-9\._]{5,}$/,
                                'message' : 'Username hanya boleh mengandung alfanumerik, _ dan . dan minimum 5 karakter'
                        },
                        'password' : {
                                'regex' : /.{6,}/,
                                'message' : 'Password harus lebih panjang dari 6 karakter'
                        },
                        'repassword' : {
                                'match' : 'password',
                                'message' : 'Password tidak sama'
                        },
                        'bday' : {
                                'regex' : /^\d{4}\-\d{2}\-\d{2}$/,
                                'message' : 'Format YYYY-MM-DD'
                        },
                        'email' : {
                                'regex' : /^[A-Za-z0-9\._]*@[A-Za-z0-9_]{2,}(\.[A-Za-z0-9_]+)*$/,
                                'message' : 'Email tidak standar'
                        },
                        'sex' : {
                                'regex' : /^(M|F)$/,
                                'message' : 'Please choose a reasonable gender'
                        },
                        'location' : {
                                'regex' : /^.{5,}$/,
                                'message' : 'Lokasi minimum 5 karakter'
                        }/*,
                        'profpic' : {
                                'regex' : /^.*\.(bmp|jpeg|jpg|gif|png)$/,
                                'message' : 'Tipe gambar: bmp|jpeg|jpg|gif|png'
                        }*/
                }

                function init() {
                        calendar("datepicker","bday");
                        validate("registrationForm" , validator);
                        $("#registerLink").onclick = function(){
                            if ($("#registerBar").getAttribute('style') == "display: none;")
                                $("#registerBar").setAttribute('style' , 'display: block;');
                            else
                                $("#registerBar").setAttribute('style' , 'display: none;');
                            return false;
                        };
                }
        </script>
    </head>
    <body onload="init()">
        <div id="bodyWrapper">
                <?php $this->render('accountbar');?>
                <div class="dummy"></div>
                <?php $this->render('menubar');?>

                <div id="content">
                    <!--<div id="loginBar">
                        <h2>Login</h2>
                        <form id="loginForm" method="post" action="<?php echo $this->createUrl('home/login')?>">
                            <div class="dtable">
                                    <div class="drow">
                                            <span class="shead"><label for="username">Username</label></span>
                                            <span><input type="text" id="username" name="username" /></span>
                                    </div>
                                    <div class="drow">
                                            <span class="shead"><label for="password">Password</label></span>
                                            <span><input type="password" id="password" name="password" /></span>
                                    </div>
                                    <div class="drow">
                                            <span class="shead"><input type="submit" value="Login" /></span>
                                    </div>
                            </div>
                        </form>
                    </div>
                    <a href="#" id="registerLink">Register</a>-->
                    <div id="registerBar" style="display: block;">
                        <h2>Register</h2>
                        <form id="registrationForm" method="post" action="<?php echo $this->createUrl('home/register');?>" enctype="multipart/form-data" onsubmit="return validateForm()">
                            <div class="dtable">
                                <div class="drow">
                                        <span class="shead"><label for="name">Nama</label></span>
                                        <span><input type="text" id="name" name="name" /></span>
                                </div>
                                <div class="drow">
                                        <span class="shead"><label for="username">Username</label></span>
                                        <span><input type="text" id="username" name="username" /></span>
                                </div>
                                <div class="drow">
                                        <span class="shead"><label for="password">Password</label></span>
                                        <span><input type="password" id="password" name="password" /></span>
                                </div>
                                <div class="drow">
                                        <span class="shead"><label for="repassword">Password Lagi</label></span>
                                        <span><input type="password" id="repassword" name="repassword" /></span>
                                </div>
                                <div class="drow">
                                        <span class="shead"><label for="bday">Tanggal lahir</label></span>
                                        <span>
                                                <input type="text" id="bday" name="bday" />
                                                <a href="#"><img onclick="toggleCalendar(this);return false;" class="dp-choose-date" alt="date" src="<?php echo $GLOBALS['base_path']?>public/img/calendar.png" title="Pilih Tanggal" /></a>
                                                <span class="dummy"></span>
                                        </span>
                                </div>
                                <div class="drow">
                                        <span class="shead"><label for="email">Email</label></span>
                                        <span><input type="text" id="email" name="email" /></span>
                                </div>
                                <?php /*<div class="drow">
                                        <span class="shead"><label for="profpic">Foto Profil</label></span>
                                        <span><input type="file" id="profpic" name="profpic" /></span>
                                </div>*/?>
                                <div class="drow">
                                        <span class="shead"><label for="sex">Jenis Kelamin</label></span>
                                        <span>
                                                <select id="sex" name="sex">
                                                    <option value="M">L</option>
                                                    <option value="F">P</option>
                                                </select>
                                        </span>
                                </div>
                                <div class="drow">
                                        <span class="shead"><label for="location">Location</label></span>
                                        <span><input type="text" id="location" name="location" /></span>
                                </div>
                                <div class="drow">
                                        <span class="shead"><input type="submit" value="Daftar" /></span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div id="photoSearchResult" style="float: left; display: block;">
						<h2>Foto - Foto</h2>
						<?php foreach($samplePhotos as $photo) : ?>
						<div class="photoThumb">
							<img src="<?php echo $photo->getUrl();?>" alt="" />
						</div>
						<?php endforeach;?>
					</div>
                    <?php if (count($photos) > 0 || count($users) > 0) : ?>
                    <div id="searchResult">
                        <div id="userSearchResult">
                            <h2>Hasil pencarian pengguna</h2>
                            <?php foreach($users as $user) : ?>
                                <div class="userSearchResultContent">
                                    <div>
                                        <a href="<?php echo $this->createUrl('profile/view/' . $user->id)?>">
                                            <img src="<?php if($user->getProfilePicture() != NULL) echo $user->getProfilePicture()->getUrl();?>" alt="" />
                                        </a>
                                    </div>
                                    <div>
                                        <?php echo $user->getProfileLink();?>
                                    </div>
                                </div>
                            <?php endforeach;?>
                        </div>
                        <div id="photoSearchResult">
                            <div class="dummy"></div>
                            <h2>Hasil pencarian foto</h2>
                            <?php foreach($photos as $photo) : ?>
                            <div class="photoThumb">
                                <img src="<?php echo $photo->getUrl();?>" alt="" />
                            </div>
                            <?php endforeach;?>
                        </div>
                    </div>
                    <?php endif;?>
                    <div class="dummy"></div>
                </div>
        </div>
        <div id="datepicker"></div>
        <script src="<?php echo $GLOBALS['base_path']?>public/js/calendar.js" type="text/javascript"></script>
    </body>

</html>
